[Feat] 비동기 분석 Worker에 Curated Corpus Context 전달 - #235
Conversation
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthrough분석 retrieval 결과를 ChangesCurated corpus analysis flow
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant AnalysisService
participant CorpusRetrievalService
participant AnalysisWorkerBridgeService
participant CorpusReferenceContext
participant AnalysisWorker
AnalysisService->>CorpusRetrievalService: retrieveForAnalysis(...)
CorpusRetrievalService-->>AnalysisService: RetrievalContext
AnalysisService->>AnalysisWorkerBridgeService: AnalysisExecutionPayload 전달
AnalysisWorkerBridgeService->>CorpusReferenceContext: from(retrievalContext)
CorpusReferenceContext-->>AnalysisWorkerBridgeService: corpusReferences
AnalysisWorkerBridgeService->>AnalysisWorker: AnalysisWorkerContextResponse 전달
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.java (1)
65-87: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win기존 worker snapshot의 역직렬화 호환성을 추가로 검증하세요.
현재 테스트는 새 Java 생성자와 직렬화만 확인하며,
corpusReferences가 없는 기존 snapshot JSON을 새 코드가 읽는지는 검증하지 않습니다. rolling deploy나 retry 중 기존 snapshot을 읽을 수 있으므로, 누락된 필드가 빈 목록으로 정규화되고similarJobPostings가 유지되는 테스트를 추가하세요.As per path instructions,
src/test/**/*.java에서는 비동기 재시도·실패 복구 경로의 회귀 위험을 확인해야 합니다.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.java` around lines 65 - 87, 기존 생성자 테스트에 추가하여, corpusReferences 필드가 없는 기존 worker snapshot JSON을 objectMapper로 AnalysisWorkerContextResponse에 역직렬화하는 검증을 작성하세요. 역직렬화 후 corpusReferences가 빈 목록으로 정규화되고 기존 similarJobPostings 값이 그대로 유지되는지 확인하며, oldConstructorDefaultsSimilarJobPostingsToEmptyList와 AnalysisWorkerContextResponse를 기준으로 관련 테스트를 확장하세요.Source: Path instructions
src/test/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeServiceTest.java (1)
169-192: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick wincurated corpus context의 snapshot 재사용 경로를 테스트하세요.
현재 변경된 테스트는 최초
getContext의 성공 응답만 확인합니다. 이후 재호출에서 snapshot의 동일한corpusReferences를 반환하는지, 완료 시에도 동일 입력으로 finalize하는지 검증하지 않아 context 재조회·retry 회귀를 놓칠 수 있습니다.As per path instructions,
src/test/**/*.java에서는 비동기 재시도와 멱등성 같은 경로를 충분히 검증해야 합니다.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeServiceTest.java` around lines 169 - 192, Extend the getContext test to invoke the context retrieval again and verify the snapshot’s identical corpusReferences are reused on the retry. Also exercise completion/finalization and verify it receives the same original context input, covering the curated corpus snapshot’s idempotent reuse path and avoiding assertions limited to the initial successful response.Source: Path instructions
src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java (1)
180-217: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win답변 존재 여부 검증 로직이 두 곳에서 다른 방식으로 중복됩니다.
새로 추가된
validateAnsweredQuestions(209-216,isEmpty()체크)와 기존validateAnalysisRequest(116-129,anyMatch체크)가 동일한 "답변 1개 이상 필요" 규칙을 서로 다른 구현으로 검증하고 있습니다. 한쪽만 수정되면 두 경로의 검증 기준이 어긋날 위험이 있습니다.♻️ 공통 헬퍼로 통합 제안
public void validateAnalysisRequest(User user, Long mockApplyId) { MockApply mockApply = getOwnedMockApply(user, mockApplyId); List<Question> questions = questionRepository.findAllByMockApplyIdOrderByIdAsc(mockApply.getId()); - boolean hasAnsweredQuestion = questions.stream() - .anyMatch(question -> StringUtils.hasText(question.getAnswer())); - - if (!hasAnsweredQuestion) { - throw new GeneralException( - GeneralErrorCode.INVALID_PARAMETER, - "분석할 자소서 답변이 1개 이상 필요합니다." - ); - } + List<Question> answeredQuestions = questions.stream() + .filter(question -> StringUtils.hasText(question.getAnswer())) + .toList(); + validateAnsweredQuestions(answeredQuestions); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java` around lines 180 - 217, 통합 분석 요청 흐름의 validateAnalysisRequest와 prepareAnalysisExecution에서 중복된 답변 존재 검증을 하나의 공통 헬퍼로 통합하세요. 기존의 “답변이 1개 이상 필요” 예외 메시지와 오류 코드를 유지하고, 두 경로가 동일한 검증 기준을 사용하도록 validateAnsweredQuestions 또는 적절한 공통 메서드를 재사용하세요.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java`:
- Around line 141-157: 분석 준비 흐름에서 retrieveAnalysisReferences 호출을 read-only 트랜잭션
내부에서 실행하지 않도록 분리하세요. prepareAnalysisExecution과
CorpusRetrievalService.retrieveForAnalysis를 조정해 코퍼스 검색이
Propagation.NOT_SUPPORTED로 트랜잭션 없이 수행되게 하고, 질문 검증과 나머지 분석 실행 데이터 흐름은 기존 동작을
유지하세요.
In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.java`:
- Around line 59-62: Update AnalysisWorkerContextResponseTest’s corpusReferences
assertions to validate the complete worker JSON contract: assert the expected
category, title, content, and rank values for the first reference, while
retaining the corpusId assertion and checks that distance and embedding are
absent. Cover the new array’s serialized values precisely so missing or
incorrectly serialized fields fail the test.
In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/CorpusReferenceContextTest.java`:
- Around line 15-40: 보강된 CorpusReferenceContext 변환 테스트에서 핵심 필드와 경계 조건을 정확히
검증하세요. convertsExistingRetrievalContext는 title, category, rank, 그리고 라벨·줄바꿈을 포함한
전체 content를 contains가 아닌 정확한 문자열 비교로 확인하도록 수정하세요. CorpusReferenceContext.from 및
관련 변환 경로에 대해 blank 입력, charLimit == null, null 리스트가 각각 기대된 계약대로 처리되는 회귀 테스트를
추가하세요.
In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisInputFingerprintProviderTest.java`:
- Around line 55-76: Add tests alongside
fingerprintChangesWhenCorpusContentChanges and fingerprintIgnoresCorpusDistance
that construct RetrievalContext with non-empty questionReferences, verifying
changed question-reference content changes the fingerprint while changed
question-reference distance does not. Update or add a helper near
corpusReference to create payloads containing question references, keeping the
existing job-posting assertions unchanged.
---
Outside diff comments:
In
`@src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java`:
- Around line 180-217: 통합 분석 요청 흐름의 validateAnalysisRequest와
prepareAnalysisExecution에서 중복된 답변 존재 검증을 하나의 공통 헬퍼로 통합하세요. 기존의 “답변이 1개 이상 필요” 예외
메시지와 오류 코드를 유지하고, 두 경로가 동일한 검증 기준을 사용하도록 validateAnsweredQuestions 또는 적절한 공통
메서드를 재사용하세요.
In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.java`:
- Around line 65-87: 기존 생성자 테스트에 추가하여, corpusReferences 필드가 없는 기존 worker
snapshot JSON을 objectMapper로 AnalysisWorkerContextResponse에 역직렬화하는 검증을 작성하세요.
역직렬화 후 corpusReferences가 빈 목록으로 정규화되고 기존 similarJobPostings 값이 그대로 유지되는지 확인하며,
oldConstructorDefaultsSimilarJobPostingsToEmptyList와
AnalysisWorkerContextResponse를 기준으로 관련 테스트를 확장하세요.
In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeServiceTest.java`:
- Around line 169-192: Extend the getContext test to invoke the context
retrieval again and verify the snapshot’s identical corpusReferences are reused
on the retry. Also exercise completion/finalization and verify it receives the
same original context input, covering the curated corpus snapshot’s idempotent
reuse path and avoiding assertions limited to the initial successful response.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 60938d6b-3bb0-476b-8d90-fb70b24c9b81
📒 Files selected for processing (10)
src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponse.javasrc/main/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/CorpusReferenceContext.javasrc/main/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeService.javasrc/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisInputFingerprintProvider.javasrc/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.javasrc/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.javasrc/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/CorpusReferenceContextTest.javasrc/test/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeServiceTest.javasrc/test/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisInputFingerprintProviderTest.javasrc/test/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisServiceTest.java
✨ 어떤 이유로 PR를 하셨나요?
📋 세부 내용 - 왜 해당 PR이 필요한지 작업 내용을 자세하게 설명해주세요
📸 작업 화면 스크린샷
🚨 관련 이슈 번호 [ ]
Summary by CodeRabbit
새로운 기능
개선 사항